package com.anlu.pattern.action.chain;

import com.anlu.pattern.action.strategy.Discount;

/**
 * 责任链模式
 */
public class MultyDiscount implements Discount {

    protected MultyDiscount nextMultyDiscount;
    public MultyDiscount(MultyDiscount nextMultyDiscount){
        this.nextMultyDiscount = nextMultyDiscount;
    }

    @Override
    public int calculate(int money) {
        if(this.nextMultyDiscount!=null){
            return this.nextMultyDiscount.calculate(money);
        }
        return money;
    }
}
